<%--
    Document   : newjsp
    Created on : 2013-4-15, 9:52:53
    Author     : piaohao
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
    <head>
        <base href="<%= basePath%>"/>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <%@include file="common.jsp" %>
        <link rel="stylesheet" type="text/css" href="resource/js/app/view/portal/portal.css" />
        <script type="text/javascript" src="resource/js/app/view/portal/Portlet.js"></script>
        <script type="text/javascript" src="resource/js/app/view/portal/PortalColumn.js"></script>
        <script type="text/javascript" src="resource/js/app/view/portal/PortalDropZone.js"></script>
        <script type="text/javascript" src="resource/js/app/view/portal/PortalPanel.js"></script>
        <script type="text/javascript" src="resource/js/jquery-1.9.1.min.js"></script>
        <title>桌面</title>
        <script>
            Ext.onReady(function() {
                var docAccStore = Ext.create('Ext.data.Store', {
                    fields: ["id", "name", "status", "from", "org_name"],
                    pageSize: 15,
                    proxy: {
                        type: 'ajax',
                        url: 'doc/listAcc',
                        reader: {
                            type: 'json',
                            root: 'data'
                        }
                    },
                    autoLoad: true
                });
                var docAccGrid = Ext.create("Ext.grid.Panel", {
                    columnLines: true,
//                    frame: true,
                    selType: 'checkboxmodel', // 设置选择模式 
                    multiSelect: true, // 允许多选
                    forceFit: true,
                    columns: [
                        {header: '主键', dataIndex: 'id', hidden: true},
                        {header: '名称', dataIndex: 'name', width: 120},
                        {header: '状态', dataIndex: 'status', width: 100, renderer: function(value) {
                                if (value === "未接收") {
                                    return "<span style='color:red'>" + value + "</span>";
                                } else {
                                    return "<span style='color:blue'>" + value + "</span>";
                                }
                            }
                        },
                        {header: '发布机构', dataIndex: 'from', width: 100},
                        {header: '所属机构', dataIndex: 'org_name', width: 100}
                    ],
                    store: docAccStore,
                    tbar: [{xtype: "button", text: "查看", iconCls: "search",
                            handler: function() {
                                location.href = "doc/index2/1";
                            }}
                    ],
                    bbar: Ext.create('Ext.PagingToolbar', {
                        store: docAccStore,
                        displayInfo: true
                    })
                });

                var warnStore = Ext.create('Ext.data.Store', {
                    fields: ["id", "content", "create_time"],
                    pageSize: 15,
                    proxy: {
                        type: 'ajax',
                        url: 'warn/resultList',
                        reader: {
                            type: 'json',
                            root: 'data'
                        }
                    },
                    autoLoad: true
                });
                var warnGrid = Ext.create("Ext.grid.Panel", {
                    columnLines: true,
                    //frame: true,
                    selType: 'checkboxmodel', // 设置选择模式 
                    multiSelect: true, // 允许多选
                    forceFit: true,
                    columns: [
                        {header: '主键', dataIndex: 'id', hidden: true},
                        {header: '内容', dataIndex: 'content', width: 200},
                        {header: '扫描日期', dataIndex: 'create_time', width: 100}
                    ],
                    store: warnStore,
                    tbar: [
                        {xtype: "button", text: "查看", iconCls: "search",
                            handler: function() {
                                location.href = "warn/"
                            }}
                    ],
                    bbar: Ext.create('Ext.PagingToolbar', {
                        store: warnStore,
                        displayInfo: true
                    })
                });
                var calendarPanel = Ext.create("Ext.panel.Panel", {
                    height: 350,
                    html: "<iframe width='100%' height='100%' frameborder='0' src='/pages/main/calendar.html'></iframe>"
                });
                var docAccPanel = Ext.create("Ext.panel.Panel", {
                    height: 200,
                    overflowX: "auto",
                    overflowY: "auto",
                    items: [docAccGrid]
                });
                var warnPanel = Ext.create("Ext.panel.Panel", {
                    height: 200,
                    overflowX: "auto",
                    overflowY: "auto",
                    items: [warnGrid]
                });
                var viewport = Ext.create("Ext.Viewport", {
                    layout: {
                        type: "border",
                        padding: '0 5 5 5'
                    },
                    items: [{
                            xtype: "portalpanel",
                            region: "center",
                            items: [{
                                    id: "col-1",
                                    items: [{id: "portlet-1", title: "日历", items: calendarPanel}]
                                }, {
                                    id: "col-2",
                                    items: [
                                        {id: "portlet-2", title: "文件接收", items: docAccPanel},
                                        {id: "portlet-3", title: "最新预警", items: warnPanel}
                                    ]
                                }
                            ]}
                    ]
                });
                $(window.parent.document).find("#centerFrm").height($(window.parent.document).find("#centerPanel-body").height());
            });
        </script>
    </head>
    <body>
    </body>
</html>
